<?php
$val = $_GET['val'];
$primerlugar = $_GET['lug'];
require_once '../controlador/controladoraOrden.php';
$co = ControladoraOrden::getInstance();
$restec = $co->reportes($val);
//var_dump($res);
$cant = 12;
$ultimo = count($restec);
//if ($primerlugar < 0) {
//    $primerlugar = 0;
//}
//if (($primerlugar + $cant) > count($restec)) {
//    $ultlugar = count($restec);
//    $more = $primerlugar;
//} else {
//    $ultlugar = $primerlugar + $cant;
//    $more = $ultlugar;
//}
//if (($primerlugar - $cant) < 0) {
//    $pre = 0;
//} else {
//    $pre = ($primerlugar - $cant);
//}
?>
<!--<input type="submit" value="<<" style="margin-left: 20px; margin-top:10px; position:absolute" onclick="cargarAJAX('tablaOrdenesReporte.php?val=<?php echo $val; ?>&lug=<?php echo $pre; ?>', 'tablaOrdenesReporte')"/>-->
<!--<input type="submit" value=">>" style="margin-left: 1045px; margin-top:0px; position:absolute" onclick="cargarAJAX('tablaOrdenesReporte.php?val=<?php echo $val; ?>&lug=<?php echo $more; ?>', 'tablaOrdenesReporte')"/>-->
<div style="margin-left: 48%">
    <h1>Reportes</h1>
</div>
<div style="margin-top: 10px; height: 710px;overflow-y: auto;width: 1130px"id="tablita">

    < <table border="1" width="auto" style="">
        <tr><th>Número</th><th>Reclamo</th><th>Cliente</th><th>Lugar</th><th>Tecnicos</th><th>Estado</th><th>Precio</th><th>Pagada</th><th>Fecha Pago</th><th>Cont</th></tr>
        <?php
        for ($i = $primerlugar; $i < $ultimo; $i++) {
            $orden = $restec[$i];
            if ($orden['controlada'] == 1) {
                ?>
                <tr style="background-color: lawngreen">
                    <?php
                } else {
                    ?>
                <tr style="background-color: green">
                    <?php
                }
                ?>

                <td><?php echo $orden['numero'] ?></td>
               
                <td><?php echo $orden['reclamo'] ?></td>
                <td><?php echo $orden['cliente'] ?></td>
                <td><?php echo $orden['lugar'] ?></td>

                <td><?php echo $orden['tecnicos'] ?></td>

                <td><?php echo $orden['estado'] ?></td>
                <td><?php echo $orden['precio'] ?></td>
                <td><?php echo $orden['pagada'] ?></td>
                 <td><?php echo $orden['fechapago'] ?></td>
               
                                <td><input type="checkbox" <?php echo ($orden['controlada'] == 1) ? 'checked' : '' ?> style=" width: 20px;" id="<?php echo $i ?>" onclick="cargarAJAX('../AJAX.php?opt=2013.3&numero=<?php echo $orden['numero'] ?>&controlada='+document.getElementById('<?php echo $i; ?>').checked, 'aux')" /></td>
            </tr>
            <?php
        }
        ?>
    </table>
</div>
<div id="aux">

</div>